#include "LayerRichText.h"
#include "CocosGUI.h"

using namespace ui;
//************************************
// Method:    init
// FullName:  LayerRichText::init
// Access:    virtual public 
// Returns:   bool
// Qualifier:
//************************************
bool LayerRichText::init()
{

	auto origin = Director::getInstance()->getVisibleOrigin();
	auto visableSize = Director::getInstance()->getVisibleSize();

	bool ret = false;
	do 
	{
		auto richText = RichText::create();
		CC_BREAK_IF(!richText);
		richText->ignoreContentAdaptWithSize(true);
		richText->setContentSize(Size(100,100));
		richText->setPosition(Vec2(origin.x + visableSize.width/2,origin.y + visableSize.height/2));
		this->addChild(richText);

		auto line1 = RichElementText::create(1,Color3B::ORANGE,255,"264 region ","courier new",20);
		auto line2 = RichElementText::create(2,Color3B::GREEN,255,"blood temple","courier new",20);
		auto line3 = RichElementText::create(2,Color3B::RED,255,"full","courier new",20);
		richText->pushBackElement(line1);
		richText->pushBackElement(line2);
		richText->pushBackElement(line3);
		ret = true;
	} while (0);
	return ret;
}